﻿using System;
using Quartz;
using Quartz.Impl;
using Common.Logging;

namespace DLM.Schedule
{
    public class SchedulerFactory
    {
        public static void InitializeConfig()
        {
            ISchedulerFactory schedFact = new StdSchedulerFactory();
            IScheduler sched = schedFact.GetScheduler();

            sched.Start();

            DateTimeOffset runTime = DateBuilder.EvenMinuteDate(DateTimeOffset.UtcNow);


            IJobDetail job = JobBuilder.Create<CheckPartyStatusJob>()
               .WithIdentity("job1", "group1")
               .Build();

            ITrigger trigger = TriggerBuilder.Create()
              .WithIdentity("trigger1", "group1")
              //.WithDailyTimeIntervalSchedule(f=>f.OnEveryDay().EndingDailyAt(TimeOfDay.HourAndMinuteOfDay(1,0)))
              .WithDailyTimeIntervalSchedule(f=>f.WithIntervalInMinutes(600))
              .Build();

            sched.ScheduleJob(job, trigger);
            


        }
    }
}
